package LanQiao._13JavaB;

public class _2山 {

    public static void main(String[] args) {

        int count = 0;
        for (int i = 2022; i <= 2022222022; i++) {
            boolean helper = helper(i);
            if (helper) {
                count++;
            }
        }
        System.out.println(count);

    }

    public static boolean helper(int n){
        String s = String.valueOf(n);
        int left = 0, right = s.length() - 1;
        while (left <= right){
            if (left > 0 && left <= right){
                char c1 = s.charAt(left);
                char c2 = s.charAt(left - 1);
                if (c1 < c2) return false;
            }
            if (s.charAt(left) == s.charAt(right)){
                left++;
                right--;
            }else {
                return false;
            }
        }
        return true;
    }
}
